package com.xyz.study.design_mode.d_factory_method;

import com.xyz.study.design_mode.d_factory_method.mode.Factory;
import com.xyz.study.design_mode.d_factory_method.mode.FactoryConcreteA;
import com.xyz.study.design_mode.d_factory_method.mode.FactoryConcreteB;
import com.xyz.study.design_mode.d_factory_method.mode.Product;

/**
 * 交给子类：其二 ---- FactoryMethod 工厂方法
 * 模板方法设计模式用于生成实例，演变为工厂方法模式
 * @author XYZ
 * @version 1.0.0
 * @since 2020/6/22
 */
public class FactoryMethod {
    public static void main(String[] args) {
        Factory factoryA = new FactoryConcreteA();
        Product productA = factoryA.create("1111");
        productA.use();
        Factory factoryB = new FactoryConcreteB();
        Product productB = factoryB.create("1111");
        productB.use();
    }
}
